<?php 
require_once('../head/nav.php'); 
?>

    <div class="col-sm-9 col-md-10">
<?php 
if($data=='0'){
    echo "<h2>没有找到你想要的社团部门!</h2>";
  }else{
 ?>

<h1 class="text-center">部门信息表</h1>
    <table class="table table-hover"> 
    <!-- 通过添加 .table-hover 类可以让 <tbody> 中的每一行对鼠标悬停状态作出响应。 -->
      <tr class="success">
        <th>部门编号</th>
        <th>部门名称</th>   
        <th>职责</th>
        <th>活动</th>
        <th>部门照片展示</th>
        <th>部长</th>
        <th>部门成员</th>
        <th>操作</th>
      </tr>
    </div>
  </div>
</div>

<?php
  //var_dump($data);
  static $count=0;
  if(array_key_exists('deid',$data)){
    $count=1;
    $row = $data;
    echo '<tr>';
    echo '<td>'.$row['deid'].'</td>';
    echo '<td>'.$row['dename'].'</td>';
    echo '<td>'.$row['duty'].'</td>';  
    echo '<td>'.$row['activityid'].'</td>';
    echo '<td align="center"><img src='.UserPhotoPath.$row['dephoto'].' width=90 height=100 alt="无头像"></td>';
    echo '<td>'.$row['minister'].'</td>';
    echo '<td>'.$row['member'].'</td>';  
    echo '<td><a href="Admin.php?c=de&m=departmentedit&id='.$row['deid'].' ">修改</a> | 
    <a href="Admin.php?c=de&m=deldepartment&id='.$row['deid'].' " onClick="return confirm(\'确定要删除吗？\');">删除</a></td>';
    echo '</tr>';
  }else{
    foreach ($data as $row) 
    {
      $count++;
      echo '<tr>';
      echo '<td>'.$row['deid'].'</td>';
      echo '<td>'.$row['dename'].'</td>';
      echo '<td>'.$row['duty'].'</td>';  
      echo '<td>'.$row['activityid'].'</td>';
      echo '<td align="center"><img src='.UserPhotoPath.$row['dephoto'].' width=90 height=100 alt="无头像"></td>';
      echo '<td>'.$row['minister'].'</td>';
      echo '<td>'.$row['member'].'</td>';  
      echo '<td><a href="Admin.php?c=de&m=departmentedit&id='.$row['deid'].' ">修改</a> | 
      <a href="Admin.php?c=de&m=deldepartment&id='.$row['deid'].' " onClick="return confirm(\'确定要删除吗？\');">删除</a></td>';
      echo '</tr>';
    }
  }
  echo '</table>';  
  echo "<table align='center'><tr><td>共有{$count}个部门</td></tr></table>";   
?>
<?php } ?>
</div> 
<?php require_once('../head/footer.php'); ?>